package com.jie.eduservice.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 远程调用订单模块
 * @author XieZhiJie
 * @create 2020-10-17 22:34
 */
@Component
@FeignClient(
        name = "service-order",
        fallback = OrderClientFeignClient.class
)
public interface OrderClient {

    /**
     * 根据课程id和用户id查询订单表中订单状态
     * 感觉这样有点不好(为什么不从token中获取用户信息呢)
     * @param courseId  课程id
     * @param memberId  用户id
     * @return          返回该用户是否购买了该课程, 若是买了则返回true
     */
    @GetMapping("/eduorder/order/isBuyCourse/{courseId}/{memberId}")
    boolean isBuyCourse(
            @PathVariable("courseId") String courseId,
            @PathVariable("memberId") String memberId
    );

}
